/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kotionokyurievna.gmail.com.genproj.logic;

import java.util.Collection;

/**
 *
 * @author Kateryna_Reznik
 */
public class Fruit {
    private String type;
 
    public Fruit(){
        setType("Fruit");
    }
       
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
    
    /**
     * Two Fruits are equals if their name are equals
     * @param obj
     * @return 
     */
    
    public boolean equals( Object obj ){
        
        if ( obj != null && getClass() == obj.getClass() ){
            Fruit other = (Fruit) obj;
            return type.equals(other.type);
	}
        return false;
    }
    
    public String toString(){
        return getClass().getName() + " [ type = " + getType() + "]";
    }
    
    void copyAll(Collection<Fruit> fromCollection, Collection<Fruit> toCollection){
       toCollection.addAll(fromCollection); 
    }
}
